package br.ufu.lsi.social.storage.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;

import br.ufu.lsi.social.storage.model.User;

public interface UserRepository extends GraphRepository<User> {
    
    User findById( long id );
    
    @Query(value = "START me=node({0}), friend=node({1} MATCH p=me-[:friend*2..6]-friend RETURN nodes(p)")
    Page<User> findByNameLike( String name, Pageable page );

}
